import com.android.build.gradle.LibraryExtension
import com.iflyings.android.convention.configureAndroidJni
import com.iflyings.android.convention.configureAndroidKotlin
import com.iflyings.android.convention.configureAndroidLibrary
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType

class AndroidLibraryJniPlugin : Plugin<Project> {
    override fun apply(target: Project) {
        with(target) {
            with(pluginManager) {
                apply("com.android.library")
                apply("org.jetbrains.kotlin.android")
            }
            val extension = extensions.getByType<LibraryExtension>()
            configureAndroidLibrary(extension)
            configureAndroidKotlin(extension)
            configureAndroidJni(extension)
        }
    }
}